|
|
|
|
|
|
|
strVersion = dbVersion30
'
End Sub |
|
|
|
|
|
|
|
|
Adding the Sub Main Routine |
|
|
|
|
|
|
|
|
There is one final routine you need to add to the project to make SQL-VB5 start. It's the sub Main method. This starts the entire application, instead of the SQLVBMain form. Add another code module to your project and set its Name property to SQLVBClass. Now add the following code to the module: |
|
|
|
|
|
|
|
|
Public Sub Main()
'
Dim strCmd As String
strCmd = Command$
'
' ignore system commands
If Left(strCmd, 1) = "-" Then
Exit Sub
End If
'
' see if user passed a file
If Trim(strCmd) <> "" Then
SQLMain strCmd
Else
SQLVBMain.Show
End If
'
End Sub |
|
|
|
|
|
|
|
|
This routine allows you to send a script file on the command line when you start the program. First, SQL-VB5 checks to see if the first character of the command is a hyphen (-). This designates a system command and is ignored by SQL-VB5. For example, when you start SQL-VB5 from the OLE request, the -Embedded command is passed to SQL-VB5 by the operating system. This lets you write special code that executes the first time someone attempts to reference the application. |
|
|
|
|
|
|
|
|
Next, if there is a valid command on the line, it is passed to the script processor for immediate attention. Otherwise, the MDI form is shown to the user. |
|
|
|
|
|
|
|
|
Now you need to change the Startup property of the project. Select Project | Properties and set the Startup Form to Sub Main. Save the project before continuing. |
|
|
|
|
|